package com.kh.statistics.video.factory;

import com.kh.statistics.video.core.login.AccountsLogin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName DefaultAccountsFactory
 * @Description TODO
 * @Author konghong1
 * @Date 2024/5/12 13:19
 * @Version 1.0
 **/
@Component
public class DefaultAccountsFactory implements AccountsFactory {

    private Map<String, AccountsLogin> map = new HashMap();

    @Autowired
    public void loadingPlatform(List<AccountsLogin> accountsLoginList) {
        accountsLoginList.forEach((item) -> {
            map.putIfAbsent(item.support(), item);
        });
    }

    @Override
    public AccountsLogin getAccountsLogin(String platform) {
        return map.get(platform);
    }
}
